# 安装HAProxy
install_haproxy:
  pkg.installed:
    - name: haproxy

# 配置文件管理
/etc/haproxy/haproxy.cfg:
  file.managed:
    - source: salt://services/files/etc/haproxy/haproxy.cfg
    - user: root
    - group: root
    - mode: 644
    - require:
      - pkg: install_haproxy

# 服务管理
manage_haproxy_service:
  service.running:
    - name: haproxy
    - enable: True
    - watch:
      - file: /etc/haproxy/haproxy.cfg
